<template>
	<view class="content" style="position: relative;">
		<headBar :toTitle="' '" :showBack="false"></headBar>
		<view style="position: fixed;top:0;background: #F4F5F9;z-index: -2;width:100%;height:100vh;"></view>
		<image class="bg-img" src="@/static/bgx.png"></image>

		<view class="mybox" style="position: relative;z-index: 2;">
			<!-- <div style="font-size: 18px;font-weight: 500;">xxxxxx网络科技有限公司</div> -->
			<view class="zflex" style="align-items: center;margin-top:12px ;">
				<image src="@/static/head.png" style="width: 64px;height: 64px;border-radius: 64px;"></image>
				<view style="margin-left: 20rpx;">
					<view class="zflex zcenter">
						<div class="p1">{{uInfo.userName}}</div>
						<div class="pn">{{qxmanage.isManageer==1?'管理员':'员工'}}</div>
					</view>
					<view class="p2">{{uInfo.phonenumber}}</view>
				</view>
			</view>

			<div class="zflex" style="margin-top: 20px;">
				<div class="mmitem33">
					<div class="view1">{{resData1.pendingVerification | formatsNumber}}</div>
					<div class="view2">待核销金额(元)</div>
				</div>
				<div class="mmitem33">
					<div class="view1">{{resData1.accumulatedReceipts | formatsNumber}}</div>
					<div class="view2">已加油金额(元)</div>
				</div>
				<div class="mmitem33">
					<div class="view1">{{resData1.accumulatedPetroleum | formatsNumber}}</div>
					<div class="view2">已加油数量(升)</div>
				</div>
			</div>
		</view>




		<view class="baseCon" style="margin-top: 20px;padding:0 12.5px ;">

			<view class="zflex zcenter" @click="goPage('/pages/my/company/detail?id=' + station.stationId)"
				style="padding:28rpx 0;">
				<image class="img-micon" src="@/static/icon3.png"></image>
				<view class="v1tit" style="margin-right: auto;">认证资料</view>
				<u-icon name="arrow-right" color="#939BAB" size="16"></u-icon>
			</view>
			<div v-if="qxmanage.isManageer==1">
				<u-line color="#EBEDF0"></u-line>
				<view class="zflex zcenter" @click="goPage('/pages/my/users/users')" style="padding:28rpx 0;">
					<image class="img-micon" src="@/static/icon1.png"></image>
					<view class="v1tit" style="margin-right: auto;">我的员工</view>
					<u-icon name="arrow-right" color="#939BAB" size="16"></u-icon>
				</view>
			</div>
			<div v-if="qxmanage.isAfterSales==1">
				<u-line color="#EBEDF0"></u-line>
				<view class="zflex zcenter" @click="goPage('/pages/my/shouhou/shouhou')" style="padding:28rpx 0;">
					<image class="img-micon" src="@/static/icon2.png"></image>
					<view class="v1tit" style="margin-right: auto;">售后管理</view>
					<u-icon name="arrow-right" color="#939BAB" size="16"></u-icon>
				</view>
			</div>
		</view>

		<view class="baseCon" style="margin-top: 12px;padding:0 12.5px ;">

			<view class="zflex zcenter" style="padding:28rpx 0;" @click="callKefu">
				<image class="img-micon" src="@/static/icon5.png"></image>
				<view class="v1tit" style="margin-right: auto;">联系客服</view>
				<u-icon name="arrow-right" color="#939BAB" size="16"></u-icon>
			</view>
			<u-line color="#EBEDF0"></u-line>
			<view class="zflex zcenter" @click="goPage('/pages/my/setting/setting')" style="padding:28rpx 0;">
				<image class="img-micon" src="@/static/icon4.png"></image>
				<view class="v1tit" style="margin-right: auto;">设置</view>
				<u-icon name="arrow-right" color="#939BAB" size="16"></u-icon>
			</view>
		</view>

		<!-- <view class="logOutbtn" @click="logOut">退出登录</view> -->
		<!-- v-if="stationAuth==0||stationAuth==4" -->
		<rzView :stationAuth="station.stationAuth" v-if="station.stationAuth==0||station.stationAuth==4"></rzView>
	</view>

</template>

<script>
	// #ifdef MP-WEIXIN
	import headBar from '@/components/headerBar/headBar.vue'
	// #endif
	// #ifdef H5
	import headBar from '@/components/headerBar/kongbai.vue'
	// #endif

	import rzView from '@/pages/my/company/rzCard.vue'
	import {
		getUsercookie,
		removeToken,
	} from '@/utils/auth.js'
	import {
		upperHalfCard,
		getUserInfo,
	} from '@/request/api.js'

	export default {
		components: {
			headBar,
			rzView
		},
		data() {
			return {
				uInfo: {},
				resData1: {
					accumulatedPetroleum: 0,
					accumulatedReceipts: 0,
					petroleumToday: 0,
					receivedPaymentToday: 0,
					pendingVerification: 0,
				},
				station: {
					stationAuth: null, //0未认证 1认证中 2已认证 3认证失败 4未上传企业资质
					stationId: null,
				},
				qxmanage: {
					isAfterSales: 0, // 售后权限 1是 0否
					isManageer: 0, // 是否管理员 1是 0否
					isWriteOff: 0, // 核销权限 1是 0否
				},

			}
		},
		onShareAppMessage() {
			return {
				title: '',
				path: '/pages/index/index'
			};
		},
		onLoad() {

		},
		onShow() {
			this.getUInfo()
		},
		onLoad() {
			const res = getUsercookie()
			this.uInfo = res
			console.log(res)
			this.getMsg1();
		},
		methods: {

			getUInfo() {
				getUserInfo().then(res => {
					this.station.stationAuth = res.stationAuth
					this.station.stationId = res.stationId

					this.qxmanage.isWriteOff = res.isWriteOff
					this.qxmanage.isManageer = res.isManageer
					this.qxmanage.isAfterSales = res.isAfterSales
					//0未认证 1待审核 2已认证 3认证失败 4未上传企业资质
					if (res.stationAuth == 1 || res.stationAuth == 3) {
						this.goPage('/pages/my/company/detail?id=' + res.stationId)
					}
				})
			},
			getMsg1() {
				upperHalfCard().then(res => {
					this.resData1 = res.data
				})
			},
			callKefu() {
				const phone = getApp().globalData.kefuPhone
				uni.makePhoneCall({
					phoneNumber: phone,
					success() {

					}
				})
			},
			logOut() {
				removeToken()
				uni.reLaunch({
					url: '/pages/login/login'
				})
			},
			goPage(e) {
				uni.navigateTo({
					url: e
				})
			},
		}
	}
</script>

<style scoped>
	.mybox {
		padding: 0 16px;
		padding-top: 24px;
	}

	.mybox .p1 {
		font-size: 20px;
		font-weight: 500;
	}

	.mybox .pn {
		display: flex;
		padding: 2px 4px;
		align-items: center;
		gap: 10px;
		border-radius: 2px;
		font-size: 10px;
		color: #FF7D00;
		margin-left: 12px;
		background: var(--Warning-1-, #FFF7E8);
	}

	.mybox .p2 {
		color: #83878E;
		margin-top: 4px;
	}

	.mmitem33 {
		width: 33.33%;
		text-align: center;
	}

	.mmitem33 .view1 {
		color: #252733;
		font-weight: 600;
		font-size: 18px;
		margin-bottom: 8px;
	}

	.mmitem33 .view2 {
		font-size: 12px;
		color: #63666B;
	}

	.img-micon {
		width: 20px;
		height: 20px;
		margin-right: 6px;
	}

	.v1tit {
		color: #3B444C;
	}
</style>